package TestModel;

import java.util.LinkedList;

import VisibilityGraph.CrossCap;

import DataModel.CommonLibrary.CommonDefs;
import DataModel.LayoutManager.CLayoutManager;
import DataModel.LayoutManager.CRectangle;
import junit.framework.TestCase;

public class crossCapTest extends TestCase {
	
	double cf = 1;
	CRectangle u1;
	CRectangle u2;
	CRectangle u3;
	CRectangle u4;
	CRectangle u5;
	double resXExp = 0.666;
	double resYExp = 5.5;
	LinkedList<CRectangle> urecs;
	private void initTest() {
		u1 = new CRectangle(1,2,3,6,CommonDefs.Layer.Metal1,1);
		u2 = new CRectangle(2,5,7,7,CommonDefs.Layer.Metal1,2);
		u3 = new CRectangle(2,0,7,3,CommonDefs.Layer.Metal1,3);
		u4 = new CRectangle(6,2,10,6,CommonDefs.Layer.Metal1,4);
		u5 = new CRectangle(1,7,10,9,CommonDefs.Layer.Metal1,5);
		urecs =  new LinkedList<CRectangle>();
		urecs.add(u1);
		urecs.add(u2);
		urecs.add(u3);
		urecs.add(u4);
		urecs.add(u5);
	}
	public void testCrossCap(){
		initTest();
		double resX =  CrossCap.calcCrossCap(urecs,'x',cf);		
		double resY =  CrossCap.calcCrossCap(urecs,'y' ,cf);
	
		
		assertEquals(resXExp, resX,0.001);
	
		assertEquals(resYExp, resY,0.001);
		
	}

}
